import request from "@/utils/request"

export function list(obj) {
  return request({
    url: "/jobSpiderInfoController/list",
    method: "get",
    params: obj
  })
}


export function add(obj) {
  return request({
    url: "/jobSpiderInfoController/add",
    method: "post",
    data: obj
  })
}

export function update(obj) {
  return request({
    url: "/jobSpiderInfoController/update",
    method: "post",
    data: obj
  })
}

export function startAtOnce(obj) {
  return request({
    url: "/jobSpiderInfoController/startAtOnce",
    method: "get",
    params: obj
  })
}

export function config(obj) {
  return request({
    url: "/jobSpiderInfoController/config",
    method: "post",
    data: obj
  })
}

export function temp(obj) {
  return request({
    url: "/jobSpiderInfoController/save/temp",
    method: "post",
    data: obj
  })
}

export function del(obj) {
  return request({
    url: "/jobSpiderInfoController/delete",
    method: "post",
    data: obj
  })
}

export function getRulesList(obj) {
  return request({
    url: "/jobSpiderInfoController/rule/list",
    method: "POST",
    data: obj
  })
}

export function getRuleData(obj) {
  let { pageNo, pageSize } = obj;
  return request({
    url: "/jobSpiderInfoController/tab/rule/" + obj.ruleId,
    method: "GET",
    params: { pageNo, pageSize }
  })
}

export function delRule(obj) {
  return request({
    url: "/jobSpiderInfoController/rule/delete",
    method: "post",
    data: obj
  })
}

export function refreshRule(obj) {
  return request({
    url: "/jobSpiderInfoController/rule/refresh",
    method: "post",
    data: obj
  })
}

export function exportData(obj) {
  // return request({
  //   url: "/jobSpiderInfoController/export",
  //   method: "GET",
  //   params: obj
  // });
  // window.open("http://10.129.203.73:7066" + "/api/jobSpiderInfoController/export?id=" + obj.id + "&type=" + obj.type);
  window.open(process.env.VUE_APP_DOWN_HOST + "/api/jobSpiderInfoController/export?id=" + obj.id + "&type=" + obj.type);
}

export function getJobSpiderInfo(obj) {
  return request({
    url: "/jobSpiderInfoController/" + obj.id,
    method: "GET"
    // params: { pageNo, pageSize }
  })
}


// export function getRulesData(obj) {
//   return request({
//     url: "/jobSpiderInfoController/rule/data",
//     method: "get",
//     params: obj
//   })
// }


// export function jobDeal(obj) {
//   return request({
//     url: "/interfaceDataCollectJobConfig/jobDeal",
//     method: "get",
//     params: obj
//   })
// }

// export function query(obj) {
//   return request({
//     url: "/interfaceDataCollectJobConfig/" + obj.id,
//     method: "get"
//   })
// }


// export function call(obj) {
//   return request({
//     url: "/jobInterfaceDatasource/interface/call/" + obj.id,
//     method: "get"
//     // params: obj
//   })
// }

